- page_description brand_title unless page_description
- site_name = _('GitLab')
- omit_og = sign_in_with_redirect?
%head{ omit_og ? { } : { prefix: "og: http://ogp.me/ns#" } }
  %meta{ charset: "utf-8" }
  %meta{ 'http-equiv' => 'X-UA-Compatible', content: 'IE=edge' }
  %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1' }
  %title= page_title(site_name)
  = Gon::Base.render_data(nonce: content_security_policy_nonce)
  = yield :project_javascripts

  = render 'layouts/startup_js'
  = yield :startup_js

  - if page_canonical_link
    %link{ rel: 'canonical', href: page_canonical_link }

  = yield :prefetch_asset_tags

  - diffs_colors = user_diffs_colors
  = stylesheet_link_tag "themes/#{user_application_theme_css_filename}" if user_application_theme_css_filename
  = render 'layouts/diffs_colors_css', diffs_colors if diffs_colors.present? || request.path == profile_preferences_path

  - if user_application_theme == 'gl-dark'
    %meta{ name: 'color-scheme', content: 'dark light' }
    = stylesheet_link_tag_defer "application_dark"
    = yield :page_specific_styles
    = stylesheet_link_tag_defer "application_utilities_dark"
  - else
    = stylesheet_link_tag_defer "application"
    = yield :page_specific_styles
    = stylesheet_link_tag_defer 'application_utilities'
  = stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations']
  = stylesheet_link_tag "test_environment", media: "all" if Rails.env.test?

  = stylesheet_link_tag_defer "fonts"

  = stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}"

  = stylesheet_link_tag 'performance_bar' if performance_bar_enabled?
  = render 'layouts/snowplow'
  = render 'layouts/loading_hints'

  = render_if_exists 'layouts/header/translations'
  - if Feature.enabled?(:enable_new_sentry_clientside_integration, current_user) && Gitlab::CurrentSettings.sentry_enabled
    = webpack_bundle_tag 'sentry'
  - elsif Gitlab.config.sentry.enabled
    = webpack_bundle_tag 'legacy_sentry'
  = webpack_bundle_tag 'performance_bar' if performance_bar_enabled?

  = yield :page_specific_javascripts

  = webpack_bundle_tag 'super_sidebar' if show_super_sidebar?

  = webpack_controller_bundle_tags

  - unless omit_og
    -# Open Graph - http://ogp.me/
    %meta{ property: 'og:type', content: "object" }
    %meta{ property: 'og:site_name', content: site_name }
    %meta{ property: 'og:title', content: page_title }
    %meta{ property: 'og:description', content: page_description }
    %meta{ property: 'og:image', content: page_image }
    %meta{ property: 'og:image:width', content: '64' }
    %meta{ property: 'og:image:height', content: '64' }
    %meta{ property: 'og:url', content: request.base_url + request.fullpath }

    -# Twitter Card - https://dev.twitter.com/cards/types/summary
    %meta{ property: 'twitter:card', content: "summary" }
    %meta{ property: 'twitter:title', content: page_title }
    %meta{ property: 'twitter:description', content: page_description }
    %meta{ property: 'twitter:image', content: page_image }
    = page_card_meta_tags

  = csrf_meta_tags
  = csp_meta_tag
  = action_cable_meta_tag

  %link{ rel: 'manifest', href: manifest_path(format: :json) }
  = favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png'

  -# Apple Safari/iOS home screen icons
  = favicon_link_tag 'apple-touch-icon.png', rel: 'apple-touch-icon'

  -# OpenSearch
  %link{ href: search_opensearch_path(format: :xml), rel: 'search', title: 'Search GitLab', type: 'application/opensearchdescription+xml' }

  = yield :meta_tags

  = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id')
  = render 'layouts/matomo' if extra_config.has_key?('matomo_url') && extra_config.has_key?('matomo_site_id')
  -# This is needed by [GitLab JH](https://gitlab.com/gitlab-jh/gitlab/-/issues/184)
  = render_if_exists "layouts/frontend_monitor"
  %meta{ name: "description", content: page_description }
  %meta{ name: 'theme-color', content: user_theme_primary_color }
